const mongoose = require("mongoose")
const crypto = require("crypto") //引用加密模块
const ObjectId = mongoose.Schema.Types.ObjectId;
const SupplierGoodsSchema = new mongoose.Schema({
    // 供应商商品数据模型
    Supplier: {    //关联的供应商
        type: ObjectId,
        ref: "Supplier"
    },
    nickname: String,    //商品名
    category: String,    //商品类别，狗粮、猫粮 
    material: String,    //材质类别，玩具、
    specifications: String,    //适用什么类型犬
    exclusive: String,    //贵宾专用、比熊专用等；
    packaging: String,    //包装规格比如1kg
    taste: String,   //商品口味
    special: String,   // 特殊功用比如美毛
    origin: String,   // 产地
    manufacturedate: Date,  //生产日期；
    shelflife: String,   //保质期
    featuresthat: String,   //特色说明
    price: String,   //价格
    img: "",   //需要大、小图路径
    salesamount: Number  //销售数量,统计会用到
}, {
    versionKey: false,
    timestamps: {
        createdAt: 'createTime',
        updatedAt: 'updateTime'
    } //自动管理修改时间
})
const suppliergoods = mongoose.model("suppliergoods", SupplierGoodsSchema);

module.exports = suppliergoods;